jQuery(document).ready(function() {
    var a = get_entry_url();
    $("#restaurant_open_apply_city_id").change(function() {
        var d = $(this);
        d.next().next().next().html("<option value='0'>请选择所在入口</option>");
        d.next().next().html("<option value='0'>请选择所在区域</option>");
        d.next().html("<option value='0'>请选择所在区</option>");
        if (d.val()) {
            var c = a + "/kaidian/selectList";
            var b = "city";
            var e = d.val();
            $.get(c, {
                name: b,
                id: e
            },
            function(f) {
                if (f) {
                    d.next().find("option").after(f)
                } else {
                    d.next().html("<option value='0'>请选择所在区</option>")
                }
            })
        } else {
            d.next().html("<option value='0'>请选择所在区</option>")
        }
    });
    $("#restaurant_open_apply_district_id").change(function() {
        var d = $(this);
        d.next().next().html("<option value='0'>请选择所在入口</option>");
        d.next().html("<option value='0'>请选择所在区域</option>");
        if (d.val()) {
            var c = a + "/kaidian/selectList";
            var b = "district";
            var e = d.val();
            $.get(c, {
                name: b,
                id: e
            },
            function(f) {
                if (f) {
                    d.next().find("option").after(f)
                } else {
                    d.next().html("<option value='0'>请选择所在区域</option>")
                }
            })
        } else {
            d.next().html("<option value='0'>请选择所在区域</option>")
        }
    });
    $("#restaurant_open_apply_zone_id").change(function() {
        var d = $(this);
        d.next().html("<option value='0'>请选择所在入口</option>");
        if (d.val()) {
            var c = a + "/kaidian/selectList";
            var b = "zone";
            var e = d.val();
            $.get(c, {
                name: b,
                id: e
            },
            function(f) {
                if (f) {
                    d.next().find("option").after(f)
                } else {
                    d.next().html("<option value='0'>请选择所在入口</option>")
                }
            })
        } else {
            d.next().html("<option value='0'>请选择所在入口</option>")
        }
    })
});